home *** CD-ROM | disk | FTP | other *** search
- #
- # client.tcl
- #
- # Multiplayer client specific win/loose handling.
- #
-
-
- # Client looses game
- proc client_loose {} {
-
- puts "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\n"
- puts "You loose :(\n"
- puts "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\n"
-
- # Get user clan
- set clan [/world.getuserclan]
- if {$clan == "null"} {
- return
- }
-
- # Remove Handcontrol.
- /world.unsethandcontrol
-
- # Drop artefacts from character's belt.
- set character [$clan.getmaennel]
- if {$character != "null"} {
- drop_artefacts $character
- }
-
- # Release all objects in clan except island
- release_objects $clan
-
- # Make sure there is no empty user clan! (Empty user clans are always
- # trouble...)
- $clan.setasuser false
-
- # Provide overview of level.
- /world.resetviewer
- /world.setviewer2 "/world/viewers/freeviewer"
- /world/viewers/freeviewer.overview
-
- # Open ingame `loose' menu (If menu is open, close it).
- if {[/sys/servers/menuhandler.menuopen] == "true"} {
- /sys/servers/menuhandler.closemenu
- }
- /sys/servers/menuhandler.openmenu "multiplayer_loose"
- /sys/servers/menuhandler.reset
- }
-
-
- # Client wins game
- proc client_win {} {
-
- puts "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\n"
- puts "You win :)\n"
- puts "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\n"
-
- # Remove Handcontrol.
- /game/handler/search.sethaircrossowner "null"
- /world.unsethandcontrol
-
- # Provide overview of level.
- /world.resetviewer
- /world.setviewer2 "/world/viewers/freeviewer"
- /world/viewers/freeviewer.overview
-
- # Open ingame `win' menu (If menu is open, close it).
- if {[/sys/servers/menuhandler.menuopen] == "true"} {
- /sys/servers/menuhandler.closemenu
- }
- /sys/servers/menuhandler.openmenu "multiplayer_win"
- /sys/servers/menuhandler.reset
- }
-
-
- # Host left game
- proc connection_lost {} {
-
- puts "*** CONNECTION LOST! \n"
-
- # Get user clan
- set clan [/world.getuserclan]
- if {$clan == "null"} {
- return
- }
-
- # Remove Handcontrol.
- /world.unsethandcontrol
-
- # Drop artefacts from character's belt.
- set character [$clan.getmaennel]
- if {$character != "null"} {
- drop_artefacts $character
- }
-
- # Release all objects in clan except island
- release_objects $clan
-
- # Make sure there is no empty user clan! (Empty user clans are always
- # trouble...)
- $clan.setasuser false
-
- # Provide overview of level.
- /world.resetviewer
- /world.setviewer2 "/world/viewers/freeviewer"
- /world/viewers/freeviewer.overview
-
- # Open `connection lost' menu
- if {[/sys/servers/menuhandler.menuopen] == "false"} {
-
- /sys/servers/menuhandler.openmenu "connection_lost"
- /sys/servers/menuhandler.reset
- }
- }
-
- # Respawn player at character starting position given by own island.
- proc respawn_character {} {
-
- set clan [/world.getuserclan]
- if {$clan != "null"} {
-
- set character [$clan.getmaennel]
- set island [$clan.getplayerisland]
-
- if {$character != "null"} {
- if {[$character.getstate] == "gameend"} {
- if {[$character.isshadow] == "false"} {
- puts "*** Respawn character $character"
-
- # Drop players artefacts
- drop_artefacts $character
-
- # Move player back to island.
- $character.respawn
- $character.setstate "normal"
- $character.setenergy 1
- }
- }
- }
- }
- }
-
- # Drop all artefacts from character's belt to character's position.
- proc drop_artefacts {character} {
-
- set artefacts [$character.artefactlist]
-
- puts "*** Drop artefacts. "
-
- set pos [$character.getposition]
- set env_clan [/world.getenvironmentclan]
- set clan [$character.getclan]
-
- foreach i $artefacts {
- $character.takeoutartefact $i
- $i.setposition [lindex $pos 0] [expr [lindex $pos 1] + 3] [lindex $pos 2]
-
- if {$clan != "null"} {
- if {$env_clan != "null"} {
- $clan.moveobjecttoclan [$i.getfullname] [$env_clan.getclanid]
- }
- }
- }
- }
-
- # Release all objects in `clan' except for island.
- proc release_objects {clan} {
-
- # Iterate through objects in clan
- for {set i [$clan.gethead]} \
- {$i != "null"} \
- {set i [$i.getsucc]} {
-
- # Look for lighthouse
- if {[$i.isvehicleclass "concret.nature.island"] == "false"} {
-
- $i.setremoveable true
- }
- }
- }
-
-